<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>${functionName}管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			layer.load(1, {
			    shade: [0.3,'#000'] //0.1透明度的白色背景
			});
			$("#searchForm").submit();
        	return false;
        }
        <shiro:hasPermission name="${permissionPrefix}:edit">
		function deleteById(id){
			layer.confirm('确认要删除该${functionName}吗？', {
				btn: ['确定','取消']
			}, function(){
				window.location.href='${r"${ctx}"}/${urlPrefix}/delete?id='+id;
			}, function(){
				layer.msg('删除取消', {
					time: 2000 //2s后自动关闭
					 });
			});
        }
        </shiro:hasPermission>
	</script>
</head>
<body>
	<ul class="nav nav-tabs nav-tabss">
		<li class="active"><a href="${r"${ctx}"}/${urlPrefix}/">${functionName}列表</a></li>
		<shiro:hasPermission name="${permissionPrefix}:edit"><li><a href="${r"${ctx}"}/${urlPrefix}/form">${functionName}添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="${className}" action="${r"${ctx}"}/${urlPrefix}/" method="post" class="breadcrumb form-search form-inline">
		<input id="pageNo" name="pageNo" type="hidden" value="${r"${page.pageNo}"}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${r"${page.pageSize}"}"/>
		<#list columnMetaDatas as columnMetaData>
            <label>${columnMetaData.javaName}：</label>
            <form:input path="${columnMetaData.javaName}" htmlEscape="false" cssClass="form-control"/>
		</#list>
		&nbsp;<input id="btnSubmit" class="btn btn-sm btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${r"${message}"}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr>
			<#list columnMetaDatas as columnMetaData>
            <th>${columnMetaData.javaName}</th>
			</#list>
			<shiro:hasPermission name="${permissionPrefix}:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${r"${page.list}"}" var="${className}">
			<tr>
				<#list columnMetaDatas as columnMetaData>
                <td>${r"${"}${className}.${columnMetaData.javaName}${r"}"}</td>
				</#list>
				<shiro:hasPermission name="${permissionPrefix}:edit"><td>
    				<a href="${r"${ctx}"}/${urlPrefix}/form?id=${"${"+className+".id}"}">修改</a>
                    <a href="javascript:deleteById('${"${"+className+".id}"}')">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${r"${page}"}</div>
</body>
</html>
